import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;

/*
 * @Author: qianmingtian
 * @Date: 2020-06-19 09:55:52
 * @LastEditors: qianmingtian
 * @LastEditTime: 2020-07-01 14:35:47
 * @FilePath: \qianmingtian.github.io\code\java\ListTest.java
 */ 
public class ListTest {
    public static void main(String[] args) {
        List<String> ls = new LinkedList<String>();
  
        ls.add("fads");
        ls.add("fadssad");
        ls.add("fadsdgf");

        Iterator<String> it = ls.iterator();
        String first = it.next();
        String second  = it.next();
        it.remove();
        /**
         * ListIterator 可以用于反向遍历链表
         */
        ListIterator<String> lit = ls.listIterator();
        lit.next();
        String pre = lit.previous();
        lit.remove(); //remove操作会删除遍历过的前一个元素
        System.out.println(pre);
        System.out.println(ls);
        System.out.println(it);
    }
}/*
 * @Author: qianmingtian
 * @Date: 2020-06-19 09:55:52
 * @LastEditors: qianmingtian
 * @LastEditTime: 2020-06-19 09:55:52
 * @FilePath: \qianmingtian.github.io\code\java\ListTest.java
 */ 
